package com.zhengqing.design.action.strategy._01.strategy;

import com.zhengqing.design.action.strategy._01.service.ICouponCalStrategy;

import java.math.BigDecimal;

/**
 * <p> 策略 </p>
 *
 * @author zhengqingya
 * @description
 * @date 2022/12/16 11:16
 */
public class CouponStrategyContext<T> {

    /**
     * 优惠策略
     */
    private ICouponCalStrategy<T> couponCalStrategy;


    public CouponStrategyContext(ICouponCalStrategy<T> couponCalStrategy) {
        this.couponCalStrategy = couponCalStrategy;
    }

    public BigDecimal calPrice(BigDecimal price, T couponInfo) {
        return this.couponCalStrategy.calPrice(price, couponInfo);
    }

}
